package com.StarStudio.Mapper;

import com.StarStudio.Domain.Zone;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ZoneMapper {

    @Select("select * from zone")
    public List<Zone> getAll();

    @Select("select * from zone where zone_id = #{zoneId}")
    public Zone getById(int zoneId);

    @Insert("insert into zone values (null,#{zone_name}, #{zone_area}, #{zone_treenum}, #{zone_treevariety})")
    public void add(Zone zone);

    @Update("update zone set zone_name=#{zone_name},zone_area=#{zone_area},zone_treenum=#{zone_treenum},zone_treevariety=#{zone_treevariety} where zone_id = #{zone_id}")
    public void update(Zone zone);

    @Delete("delete from zone where zone_id = #{zoneId}")
    public void delete(Integer zoneId);

    @Select("select zone_name from zone where zone_id = #{zoneId}")
    public String getZoneNameByZoneId(int zoneId);
}
